export function formatString(template: string, values: { [key: string]: any }): string {
  return template.replace(/{(\w+)}/g, (match, key) => {
    return typeof values[key] !== 'undefined' ? values[key] : match;
  });
}

// const template = 'Hello, {name}! You have {points} points.';
// const values = {
//   name: 'Alice',
//   points: 100,
// };
//
// const result = formatString(template, values);
// console.log(result); // 输出：Hello, Alice! You have 100 points.